﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;

namespace MyTest
{
    /// <summary>
    /// Book2 的摘要说明
    /// </summary>
    public class Book2 : Product//继承
    {
        private string isbn;//书号
        private string intro;//简介

        public string Isbn
        {
            get { return isbn; }
            set {
                if (value.Length != 13)
                {
                    throw new ArgumentException("请输入13位的ISBN号");
                }
            }
        }
        public string Intro
        {
            get { return intro; }
            set { intro = value; }
        }

        public Book2():base("默认书籍名")
        {
            Debug.WriteLine("-=调用book2的无参构造方法=-");
        }

        public override string ShowDetail()
        {
            return "ISBN:" + this.isbn + "，简介：" + this.intro;
        }
        public override string Show()
        {
            //return base.Show();//在C#中base代表基类，和this差不多
            return "书籍名称：" + this.name + "书籍价格：" + this.price;
        }

        ~Book2()
        {
            Debug.WriteLine("-=调用book2的析构方法=-");
        }
    }
}
